import 'dart:io' as io;

// import 'package:firebase_core/firebase_core.dart';
// import 'package:flutter/cupertino.dart';
import 'package:event_bus/event_bus.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:gameplay_flutter/lib_baseview/lib_baseview.dart';
import 'package:get/get_core/src/get_main.dart';

import 'lib_baseview/root_page.dart';
import 'lib_baseview/theme/jr.dart';
import 'lib_baseview/utils/cache_util.dart';
import 'lib_network/old/url_config.dart';
import 'lib_runtime/global_config.dart';
import 'lib_runtime/logger.dart';
// import 'package:lib_baseview/lib_baseview.dart';
// import 'package:lib_network/lib_network.dart';
// import 'package:lib_runtime/lib_runtime.dart';

// import 'firebase_options.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // await Firebase.initializeApp(
  //   options: DefaultFirebaseOptions.currentPlatform,
  // );

  if (io.Platform.isAndroid) {
    const SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      statusBarIconBrightness: Brightness.dark,
      statusBarBrightness: Brightness.light,
      systemNavigationBarColor: Colors.transparent,
      systemNavigationBarContrastEnforced: false,
    );
    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
  }
  FlutterError.onError = (FlutterErrorDetails details) {
    String log =
        "Flutter error:  \n exception:${details.exception.toString()}  \n Stack:\n${details.stack.toString()} \n ";
    RLog.e(log);
  };
  await GlobalConfig.instance.init();
  await CacheUtil.init();
  Get.put(EventBus());
  UrlConfig.init();
  JR.init();
  runApp(const RootPage());
}
